fix(gateway): pass model to temporary AIAgent instances#830
Closed
manuelschipper wants to merge 1 commit intoNousResearch:mainfrom
Closed
fix(gateway): pass model to temporary AIAgent instances#830manuelschipper wants to merge 1 commit intoNousResearch:mainfrom
manuelschipper wants to merge 1 commit intoNousResearch:mainfrom
Conversation
Memory flush, /compress, and session hygiene create AIAgent without model=, falling back to the hardcoded default "anthropic/claude-opus-4.6". This fails with a 400 error when the active provider is openai-codex (Codex only accepts its own model names like gpt-5.1-codex-mini). Add _resolve_gateway_model() that mirrors the env/config resolution already used by _run_agent_sync, and wire it into all three temporary agent creation sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d631da7 to
e2d2e9f
Compare
Contributor
|
Merged via 66c0b71. Thanks @manuelschipper — clean, well-tested fix. Your commit is preserved with authorship. |
teknium1
added a commit
that referenced
this pull request
Mar 11, 2026
…model() Replace two inline copies of the env/config model resolution pattern (in _run_agent_sync and _run_agent) with the _resolve_gateway_model() helper introduced in PR #830. Left untouched: - Session hygiene block: different default (sonnet vs opus) + reads compression config from the same YAML load - /model command: also reads provider from same config block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_flush_memories_for_session), session hygiene auto-compressor, and/compresscommand create temporaryAIAgentinstances without passingmodel=, so they fall back to the hardcoded default"anthropic/claude-opus-4.6"openai-codex(Codex only accepts its own model names likegpt-5.1-codex-mini)_resolve_gateway_model()helper that mirrors the env/config resolution already used by_run_agent_syncand the cron scheduler_hyg_modelbut never passed it to the constructor)Error reproduced
Triggered during pre-reset memory flush when
provider: openai-codexis configured inconfig.yaml.Test plan
test_vision_tools, seefix/vision-test-flakebranch)/resetto Pili bot — flush completed, no new errors in log